package cn.wolfcode.luowowo.website.util;

import cn.wolfcode.luowowo.cache.util.RedisKeys;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse;

public class SettokenUtil {
   public static void settoken(String token, HttpServletResponse response){
       //将token设置进cookie
       Cookie cookie = new Cookie("token",token);
       //设置cookie的路径,/是通用路径
       cookie.setPath("/");
       //设置保存时间
       cookie.setMaxAge(RedisKeys.USER_LOGIN.getTime().intValue());
       //响应回浏览器
       response.addCookie(cookie);
   }

}
